package arduino;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Driver {
	private MessageQueue msgQ;
	double ambient = 700;
	double temperature = 25.0;

	public Driver(){
		ExecutorService threadExecutors = Executors.newFixedThreadPool(2);
		msgQ = new MessageQueue();
		
		try{
			threadExecutors.execute( new DriverMessageQueue( msgQ, this ) );
		}catch( Exception exception ){
			exception.printStackTrace();
		}
		
		// initialize the serial communication
		SerialTest serialComm = new SerialTest();
		serialComm.initialize( msgQ );
		System.out.println( "DRV: CarDrive serial communication has been established." );
	}
	
	// accessors + mutators
	public double getAmbient(){
		return ambient;
	}
	public void setAmbient( double newAmb ){
		ambient = newAmb;
	}
	
	public double getTemperature(){
		return temperature;
	}
	public void setTemperature( double newTemp ){
		temperature = newTemp;
	}
}
